﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VH6I_B4.ProductParsing;

namespace VH6I_B4.Datawarehouse.Models
{
    /// <summary>
    /// Omschrijft een product.
    /// </summary>
    class Product
    {
        private int id;
        private string major_brand,
                        apparaat,
                        type,
                        beleving,
                        soort,
                        formaat,
                        smaak,
                        barcode;

        public Product(Dictionary<ProductLevel, string> productInfo)
        {
            MajorBrand = productInfo[ProductLevel.MAJOR_BRAND];
            Apparaat = productInfo[ProductLevel.APPARAAT];
            Type = productInfo[ProductLevel.TYPE];
            Beleving = productInfo[ProductLevel.BELEVING];
            Soort = productInfo[ProductLevel.SOORT];
            Formaat = productInfo[ProductLevel.FORMAAT];
            Smaak = productInfo[ProductLevel.SMAAK];
            Barcode = productInfo[ProductLevel.BARCODE];
        }

        public override bool Equals(object obj)
        {
            bool result = false;

            if (obj != null)
            {
                Product product = (Product)obj;
                if (product.MajorBrand.Equals(MajorBrand)
                    && product.Apparaat.Equals(Apparaat)
                    && product.Type.Equals(Type)
                    && product.Beleving.Equals(Beleving)
                    && product.Soort.Equals(Soort)
                    && product.Formaat.Equals(Formaat)
                    && product.Smaak.Equals(Smaak)
                    && product.Barcode.Equals(Barcode))
                {
                    result = true;
                }
            }

            return result;
        }

        #region getters and setters
        public int Id               { get { return id; }            set { id = value; } }
        public string MajorBrand    { get { return major_brand; }   set { major_brand = value; } }
        public string Apparaat      { get { return apparaat; }      set { apparaat = value; } }
        public string Type          { get { return type; }          set { type = value; } }
        public string Beleving      { get { return beleving; }      set { beleving = value; } }
        public string Soort         { get { return soort; }         set { soort = value; } }
        public string Formaat       { get { return formaat; }       set { formaat = value; } }
        public string Smaak         { get { return smaak; }         set { smaak = value; } }
        public string Barcode       { get { return barcode; }       set { barcode = value; } }
        #endregion
    }
}
